﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="__ADMIN__/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui.admin/css/style.css" />
<link rel="stylesheet" type="text/css" href="__ADMIN__/layui/css/layui.css" />
<title>文章列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 分类管理 <span class="c-gray en">&gt;</span> 栏目管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
		<span class="l">
			<a href="javascript:;" onclick="dels()" class="btn btn-danger radius">
				<i class="Hui-iconfont">&#xe6e2;</i> 批量删除
			</a>
				<a href="javascript:;" onclick="articlecon_add('添加文档','{:url('document/show_add')}?pid=h','800','700')" class="btn btn-primary radius">
				<i class="Hui-iconfont">&#xe600;</i> 添加文档
			</a>
		</span>
	</div>
	<br/>
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="13">文档列表</th>
			</tr>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th >ID</th>
				<th>文档名称</th>
				<th>上级文档</th>
				<th>地址描述</th>
				<th>模型</th>
				<th>是否已启用</th>
				<th>点击查看</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		{if count($data)}
		{foreach $data as $value}
			<tr class="text-c">
				<td><input type="checkbox" value="{$value['id']}" name="userid"></td>
				<td>{$value['id']}</td>
				<td style="text-align: left">
					{$value['title']}
				</td>
				<td>{$value['pidname']}</td>
				<td>{$value['dir']}</td>
				<td>{$value['model_name']}</td>
				<td>
					{if $value['status']==1}
					<span class="label label-success radius">已启用</span>
					{else}
					<span class="label radius">已禁用</span>
					{/if}
				</td>
				<td><a title="查看详情" href="javascript:;" onclick="info('详情','{$value['id']}','800','700')" class="ml-5" style="text-decoration:none">查看详情</a></td>
				<td class="td-manage"><a title="编辑" href="javascript:;" onclick="articlecon_edit('编辑','{:url('document/edit_p')}?id={$value['id']}','800','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> <a title="删除" href="javascript:;" onclick="del(this,'{$value['id']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
			</tr>
		{if $value['xxxxx']}
			{foreach  $value['xxxxx'] as $v}
		<tr class="text-c">
			<td><input type="checkbox" value="{$v['id']}" name="userid"></td>
			<td>{$v['id']}</td>
			<td style="text-align: left">
				&nbsp;&nbsp;&nbsp;&nbsp;|-{$v['title']}
			</td>
			<td>{$v['pidname']}</td>
			<td>{$v['dir']}</td>
			<td>{$v['model_name']}</td>
			<td>
				{if $v['status']==1}
				<span class="label label-success radius">已启用</span>
				{else}
				<span class="label radius">已禁用</span>
				{/if}
			</td>
			<td><a title="查看详情" href="javascript:;" onclick="info('详情','{$v['id']}','800','700')" class="ml-5" style="text-decoration:none">查看详情</a></td>
			<td class="td-manage"><a title="编辑" href="javascript:;" onclick="articlecon_edit('编辑','{:url('document/edit_p')}?id={$v['id']}','800','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> <a title="删除" href="javascript:;" onclick="del(this,'{$v['id']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
		</tr>
				{if $v['xxxxx']}
					{foreach $v['xxxxx'] as $a}
						<tr class="text-c">
							<td><input type="checkbox" value="{$a['id']}" name="userid"></td>
							<td>{$a['id']}</td>
							<td style="text-align: left">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-{$a['title']}
							</td>
							<td>{$a['pidname']}</td>
							<td>{$a['dir']}</td>
							<td>{$a['model_name']}</td>
							<td>
								{if $a['status']==1}
								<span class="label label-success radius">已启用</span>
								{else}
								<span class="label radius">已禁用</span>
								{/if}
							</td>
							<td><a title="查看详情" href="javascript:;" onclick="info('详情','{$a['id']}','800','700')" class="ml-5" style="text-decoration:none">查看详情</a></td>
							<td class="td-manage"><a title="编辑" href="javascript:;" onclick="articlecon_edit('编辑','{:url('document/edit_p')}?id={$a['id']}','800','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> <a title="删除" href="javascript:;" onclick="del(this,'{$a['id']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
						</tr>
						{if $a['xxxxx']}
							{foreach $a['xxxxx'] as $l}
								<tr class="text-c">
									<td><input type="checkbox" value="{$l['id']}" name="userid"></td>
									<td>{$l['id']}</td>
									<td style="text-align: left">
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-{$l['title']}
									</td>
									<td>{$l['pidname']}</td>
									<td>{$l['dir']}</td>
									<td>{$l['model_name']}</td>
									<td>
										{if $l['status']==1}
										<span class="label label-success radius">已启用</span>
										{else}
										<span class="label radius">已禁用</span>
										{/if}
									</td>
									<td><a title="查看详情" href="javascript:;" onclick="info('详情','{$l['id']}','800','700')" class="ml-5" style="text-decoration:none">查看详情</a></td>
									<td class="td-manage"><a title="编辑" href="javascript:;" onclick="articlecon_edit('编辑','{:url('document/edit_p')}?id={$l['id']}','800','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> <a title="删除" href="javascript:;" onclick="del(this,'{$l['id']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
								</tr>
									{if $l['xxxxx']}
										{foreach $l['xxxxx'] as $u}
											<tr class="text-c">
												<td><input type="checkbox" value="{$u['id']}" name="userid"></td>
												<td>{$u['id']}</td>
												<td style="text-align: left">
													&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-{$u['title']}
												</td>
												<td>{$u['pidname']}</td>
												<td>{$u['dir']}</td>
												<td>{$u['model_name']}</td>
												<td>
													{if $u['status']==1}
													<span class="label label-success radius">已启用</span>
													{else}
													<span class="label radius">已禁用</span>
													{/if}
												</td>
												<td><a title="查看详情" href="javascript:;" onclick="info('详情','{$u['id']}','800','700')" class="ml-5" style="text-decoration:none">查看详情</a></td>
												<td class="td-manage"><a title="编辑" href="javascript:;" onclick="articlecon_edit('编辑','{:url('document/edit_p')}?id={$u['id']}','800','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> <a title="删除" href="javascript:;" onclick="del(this,'{$u['id']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
											</tr>

										{/foreach}
									{/if}
							{/foreach}
						{/if}
					{/foreach}
				{/if}
			{/foreach}
		{/if}
		{/foreach}
		{else}
		<tr><td colspan="13" style="text-align: center">什么都没查到</td></tr>
		{/if}
		</tbody>
	</table>

</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__ADMIN__/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="__ADMIN__/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__ADMIN__/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="__ADMIN__/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__ADMIN__/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="__ADMIN__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="__ADMIN__/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="__ADMIN__/layui/layui.all.js"></script>
<script type="text/javascript" src="__ADMIN__/js/maowenke.js"></script>
<script type="text/javascript">
	function info(title,id,w,h) {
		layer_shows(title,"{:url('info/show')}?id="+id,w,h);
    }


/*类容-增加*/
function articlecon_add(title,url,w,h){
   var $page = $(".layui-laypage-curr").children('em').eq(1).text();
   var $limit = $('select').val();
   var $tiaojian = $("#tiaojian").val();
	layer_show(title,url,w,h,function () {
	    window.location.reload();
    });
}
function showcontent($id) {
	layer_show('文章内容','{:url("articlecon/show_content")}?id='+$id,'800','800');
}
/*类容-删除*/
function del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
        ajaxUpdate('{:url("document/del")}',{id:id},'true','post',function (data) {
            console.log(data);
            window.location.reload();
        })
	});
}

/*类容-编辑*/
function articlecon_edit(title,url,w,h){
    var $page = $(".layui-laypage-curr").children('em').eq(1).text();
    var $limit = $('select').val();
    var $tiaojian = $("#tiaojian").val();
	layer_show(title,url,w,h,function () {
        window.location.reload();
    });
}
/*类容-停用*/
function articlecon_stop(obj,id){
	layer.confirm('确认要停用吗？',function(index){
        ajaxUpdate('{:url("articlecon/articlecon_stop")}',{id:id},'true','post',function (data) {
            if(data==1){
                $(obj).parents("tr").find(".td-manage").prepend('<a onClick="articlecon_start(this,'+id+')" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">已禁用</span>');
                $(obj).remove();
                layer.msg('已停用!',{icon: 5,time:1000});
            }else{
                layer.msg(data);
            }
        })
	});
}
/*类容-启用*/
function articlecon_start(obj,id){
	layer.confirm('确认要启用吗？',function(index){
	    ajaxUpdate('{:url("articlecon/articlecon_start")}',{id:id},'true','post',function (data) {
            if(data==1){
                $(obj).parents("tr").find(".td-manage").prepend('<a onClick="articlecon_stop(this,'+id+')" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
                $(obj).remove();
                layer.msg('已启用!', {icon: 6,time:1000});
            }else{
                layer.msg(data);
            }
        })
	});
}

    /**
     * 批量删除内容
     */
    function dels() {
    var $input = $("input[name=userid]");
    var idarr = [];
    $.each($input,function (i,v) {
        if($(v).prop('checked')){
            idarr.push($(v).val());
        }
    });
        layer.confirm('确认要删除吗？',function(index){
            ajaxUpdate('{:url("document/del")}',{id:idarr},'true','post',function (data) {
                console.log(data);
                window.location.reload();
            })
        });
}
</script>
</body>
</html>